Skip to content

Remove redundant null-forgiving operator in MamJsonParser.ReadClassRewrites#11772

Merged
jonathanpeppers merged 2 commits into
mainfrom
copilot/fix-reduntant-null-forgiving-operator
Jun 30, 2026
Merged

Remove redundant null-forgiving operator in MamJsonParser.ReadClassRewrites#11772
jonathanpeppers merged 2 commits into
mainfrom
copilot/fix-reduntant-null-forgiving-operator

Conversation

Copilot AI commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

MamJsonParser.ReadClassRewrites used the ! null-forgiving operator on classRewrite, which is already proven non-null by the if (classRewrite == null) continue; guard immediately above. This violates the repo rule against using ! and is redundant—the sibling ReadGlobalMethodCalls makes the identical call without it.

Changes

  • Drop the ! from the TryReadClassFromTo call in ReadClassRewrites:
- if (!TryReadClassFromTo (classRewrite!, out var from, out var to)) {
+ if (!TryReadClassFromTo (classRewrite, out var from, out var to)) {

No other lines changed. The out-of-scope JsonNode.Parse ("{}")! in ReadJson was left untouched.

Co-authored-by: jonathanpeppers <840039+jonathanpeppers@users.noreply.github.com>
Copilot AI changed the title [WIP] Remove redundant null-forgiving operator in MamJsonParser.ReadClassRewrites Remove redundant null-forgiving operator in MamJsonParser.ReadClassRewrites Jun 27, 2026
Copilot AI requested a review from jonathanpeppers June 27, 2026 16:07
@simonrozsival simonrozsival marked this pull request as ready for review June 29, 2026 11:18
Copilot AI review requested due to automatic review settings June 29, 2026 11:18
@simonrozsival simonrozsival enabled auto-merge (squash) June 29, 2026 11:19
@simonrozsival simonrozsival disabled auto-merge June 29, 2026 11:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes a redundant null-forgiving operator in MamJsonParser.ReadClassRewrites, aligning the implementation with the existing null-guard and the pattern used in ReadGlobalMethodCalls.

Changes:

  • Remove the ! null-forgiving operator from the TryReadClassFromTo call after classRewrite has already been checked for null.
Show a summary per file
File Description
src/Xamarin.Android.Build.Tasks/Utilities/MamJsonParser.cs Removes a redundant null-forgiving operator in ReadClassRewrites to comply with the repo’s “no !” rule and reflect the existing null check.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@jonathanpeppers jonathanpeppers merged commit 0548230 into main Jun 30, 2026
41 checks passed
@jonathanpeppers jonathanpeppers deleted the copilot/fix-reduntant-null-forgiving-operator branch June 30, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants